package com.teamin.wiremock;

//import com.github.tomakehurst.wiremock.client.WireMock;

public class Wiremock {
//    public static void main(String[] args) {
//        WireMock.configureFor(8062);
//        WireMock.removeAllMappings(); // 清空处理
//        try {
//            mockGet("/user", "hello");
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//    }
//
//    private static void mockGet(String url, String fileName) throws IOException {
//        ClassPathResource resource = new ClassPathResource("mock/response/" + fileName + ".txt");
//        String content = StringUtils.join(FileUtils.readLines(resource.getFile(), "UTF-8").toArray(), "\n");
//        WireMock.stubFor(WireMock.get(WireMock.urlPathEqualTo(url)).willReturn(WireMock.aResponse().withBody(content).withStatus(200)));
//    }
//
//    private static void mockPost(String url, String fileName) throws IOException {
//        ClassPathResource resource = new ClassPathResource("mock/response/" + fileName + ".txt");
//        String content = StringUtils.join(FileUtils.readLines(resource.getFile(), "UTF-8").toArray(), "\n");
//        WireMock.stubFor(WireMock.post(WireMock.urlPathEqualTo(url)).willReturn(WireMock.aResponse().withBody(content).withStatus(200)));
//    }
}
